import { Routes } from '@angular/router';
import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.component';
import { HomeComponent } from './pages/home/home.component';
import { LoginComponent } from './pages/login/login.component';
import { Home2Component } from './pages/home2/home2.component';

export const routes: Routes = [
  //加载子路由
  {
    //独立组件加载子路由component ,loadChildren 都需要
    path: 'home',
    component: HomeComponent,
    loadChildren: () =>
      import('./pages/home/home.routes').then((m) => m.HomeComponent_ROUTES)
  },
  //{ path: 'home',component: HomeComponent},
  //{ path: 'login',loadChildren: () => import('./pages/login/login.routes').then(m => m.LoginComponent_ROUTES)},
  {
    path: 'login',
    component: LoginComponent,
    loadChildren: () =>
      import('./pages/login/login.routes').then((m) => m.LoginComponent_ROUTES)
  },
  {
    path: 'home2',
    component: Home2Component,
    loadChildren: () =>
      import('./pages/home2/home2.routes').then((m) => m.Home2Component_ROUTES)
  },
  { path: '', redirectTo: 'home2', pathMatch: 'full' }, // redirect to `first-component`
  { path: '**', component: PageNotFoundComponent }// 通配符路由排在最后， 404
];
